package com.ruoyi.house.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.house.domain.CwReceiptPlanEntity;
import com.ruoyi.house.dto.request.RequestRemainingLeavingBill;
import com.ruoyi.house.dto.request.RequestSaveBillsDto;
import com.ruoyi.house.dto.request.RequestUpdateBillsDto;
import com.ruoyi.house.dto.request.UpdateCollectionsRequestDto;
import com.ruoyi.house.dto.response.DYMyPayOrdersResponseDto;
import com.ruoyi.house.dto.response.MyPayOrdersResponseDto;
import com.ruoyi.house.dto.response.RespForRentArrears;
import com.ruoyi.house.dto.response.ResponseReceiptManageDto;
import javafx.scene.control.Pagination;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author liufeng
 * @since 2018-04-16
 */
@Mapper
public interface CwReceiptPlanMapper extends BaseMapper<CwReceiptPlanEntity> {

	void updateBills(RequestUpdateBillsDto requestUpdateBillsDto);

	List<ResponseReceiptManageDto> receiptManage(Page<ResponseReceiptManageDto> page, Map<String, Object> params);
	
	List<ResponseReceiptManageDto> receiptManage(Map<String, Object> queryParams);

	void saveBills(RequestSaveBillsDto requestSaveBillsDto);

	List<CwReceiptPlanEntity> searchCwReceiptPlan();
	
	/**
	 * 
	 * @Description:查询付款单 PC端
	 * @param pagination
	 * @parm @param cfContractId
	 * @parm @return 参数
	 * @return 返回值说明
	 */
	List<MyPayOrdersResponseDto> findReceiptPlanId(Pagination pagination, Map<String,Object> param);

	/**
	 * 
	 * @Description:获取打印付款单数据
	 * @parm @param id
	 * @parm @return 参数
	 * @return 返回值说明
	 */

	DYMyPayOrdersResponseDto findDYPayOrder(Long Id);
	/**
	 * 批量修改账单信息
	 * @param updateDto
	 */
	void updateCllectionsInfo(UpdateCollectionsRequestDto updateDto);
	
	/**
	* @Description: 查询欠款
	* @param param
	* @return 返回值说明
	 */
	List<RespForRentArrears> queryForArrears(Map<String, Object> param);
	
	/**
	 * 
	 * @Description:查看订单
	 * @parm @param param
	 * @parm @return 参数
	 * @return 返回值说明
	 */
	List<MyPayOrdersResponseDto> findReceiptPlanToC(Map<String, Object> param);

	List<ResponseReceiptManageDto> selectReceiptStatus(Long cfId);
	/**
	 * 查询租务收款计划或房租收款计划
	 * @param param
	 * @return
	 */
	List<CwReceiptPlanEntity> getReceiptPlanByCondition(Map<String, Object> param);
	/**
	 * 查询合同剩余租期账单（保理申请用） 不包括逾期未付的房租账单
	 * @param requestRemainingLeavingBill 合同类型 合同ID
	 * @return
	 */
	List<CwReceiptPlanEntity> selectRemainingLeaseBill(RequestRemainingLeavingBill requestRemainingLeavingBill);
	/**
	 * 保理申请：更新账单的收款状态（未收款->已冻结）
	 * @param requestRemainingLeavingBill 收款状态
	 */
	void updateRemainingLeaseBill(RequestRemainingLeavingBill requestRemainingLeavingBill);
	/**
	 * 统计获取商户当月的需还款金额（申请保理的未收款的收款计划金额，截止到当前月的）
	 * @param businessId 商户ID
	 * @return
	 */
	BigDecimal getNeedPaybackMoney(@Param("businessId")Long businessId);

	Integer findCount(Long id);

	List<CwReceiptPlanEntity> findPlan(String format1, Integer businessId);

	List<CwReceiptPlanEntity> findPlan(Integer businessId, String startTime, String endTime, String time);



}
